add_subdirectory(exprtk EXCLUDE_FROM_ALL)
add_subdirectory(freeverb EXCLUDE_FROM_ALL)
if(NOT BESPOKE_SYSTEM_JSONCPP)
  add_subdirectory(json EXCLUDE_FROM_ALL)
  message(STATUS "Using bundled jsoncpp")
endif()
add_subdirectory(leathers EXCLUDE_FROM_ALL)
add_subdirectory(nanovg EXCLUDE_FROM_ALL)
add_subdirectory(oddsound-mts EXCLUDE_FROM_ALL)
add_subdirectory(psmove EXCLUDE_FROM_ALL)
add_subdirectory(push2 EXCLUDE_FROM_ALL)
if(NOT BESPOKE_SYSTEM_READERWRITERQUEUE)
  add_subdirectory(readerwriterqueue EXCLUDE_FROM_ALL)
  message(STATUS "Using bundled readerwriterqueue")
endif()
add_subdirectory(scalable-font2 EXCLUDE_FROM_ALL)

set(PYBIND11_NOPYTHON TRUE)
if(NOT BESPOKE_SYSTEM_PYBIND11)
  message(STATUS "Using bundled pybind11")
  add_subdirectory(pybind11 EXCLUDE_FROM_ALL)
else()
  message(STATUS "Using system installed pybind11")
  include(FindPkgConfig)
  find_package(pybind11 COMPONENTS REQUIRED)
endif()
add_library(bespoke_pybind11_wrapper INTERFACE)
target_compile_definitions(bespoke_pybind11_wrapper INTERFACE PYBIND11_EXPORT=)
target_link_libraries(bespoke_pybind11_wrapper INTERFACE pybind11::pybind11)
add_library(bespoke::pybind11 ALIAS bespoke_pybind11_wrapper)

if(NOT BESPOKE_SYSTEM_TUNING_LIBRARY)
  add_subdirectory(tuning-library EXCLUDE_FROM_ALL)
  message(STATUS "Using bundled tuning-library")
else()
  find_file(TUNING_LIB_TUNINGS NAMES Tunings.h PATHS /usr/local/include /usr/include REQUIRED)
  find_file(TUNING_LIB_TUNINGS_IMPL NAMES TuningsImpl.h PATHS /usr/local/include /usr/include REQUIRED)
  message(STATUS "Using system provided tuning-library")
endif()
add_subdirectory(xwax EXCLUDE_FROM_ALL)
